package com.yunju.xuexin.xuexincrawler.utils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class StringRegUtils {

	/**
	 * 正則截取
	 * @param regex
	 * @param source
	 * @return
	 */
	    public static String getMatcher(String regex, String source) {  
	        String result = "";  
	        Pattern pattern = Pattern.compile(regex);  
	        Matcher matcher = pattern.matcher(source);  
	        while (matcher.find()) {  
	            result = matcher.group(1);
	        }  
	        return result;  
	    }  
	    
	    public static void main(String[] args) {
	    	String STR_RSAString_REG = "str_rsaString='(.*)',";
	    	String source = "str_rsaString='C1900D308A863956A1DCEF615AF7D6E8C650974058C36C0F0E5BFA9D6EC3ED928FABF7860C47A41D5CFAF5D18C566E2412CC6655AAE8A18163A25DA926D4B350504D421F4D6DDB58ADA6414C08C52B1A71120247FA30AD9553758CAF58739BC84789973EA468E1CF46E5C7CF84F16354449C061E2A0B1AEC4748101987E91B2B',".trim();
		   System.out.println(getMatcher(STR_RSAString_REG, source));
	    }
}
